
import {useState} from 'react';
function useRecoilState(recoilState){
  return [recoilState.get(),useSetRecoilState(recoilState)];
}

function useSetRecoilState(recoilState){
    let [,forceUpdate] = useState(0);
    return newValue=>{
        recoilState.set(newValue);
        forceUpdate(x=>x+1);//为了让组件强行刷新
    }
}

export default useRecoilState;